package com.itheima.d4_byte_stream;

import java.io.*;

public class FileInputStreamTest1 {
    public static void main(String[] args) throws IOException {
        //1.创建文件字节输入流管道
        //InputStream is=new FileInputStream(new File("C:\\Users\\dell\\IdeaProjects\\file-io-app\\src\\itheima01.txt"));
        InputStream is=new FileInputStream("C:\\Users\\dell\\IdeaProjects\\file-io-app\\src\\itheima01.txt");

        //2.读取字节数据,如果有就读取到内存，没有了就返回-1
//        char c1= (char) is.read();
//        System.out.println(c1);
//
//        char c2=(char) is.read();
//        System.out.println(c2);
//
//        int c3= is.read();
//        System.out.println(c3);
        //3.使用循环读取，性能很差，汉字输出会乱码
        int b;
        while((b=is.read())!=-1){
            System.out.print((char) b);
        }

        is.close();
    }
}
